* calculate and save the statistics to memory ----------------------------------

eststo: estpost tabstat akp_nov treatment treatment_multi akp_jun               ///
recruitment_pool treatment_nonterror casualty_district kurdish_district         ///
akp_district higher_education min_margin turnout_jun,                           ///             
statistics(mean median sd min max) columns(statistics)

* print the results ------------------------------------------------------------

esttab,                                                                         ///
cells("mean(fmt(2)) sd(fmt(2)) p50(fmt(2)) min(fmt(2)) max(fmt(2))")            ///
noobs label nonumber title("Table S1: Descriptive statistics")                             

* save the results -------------------------------------------------------------

esttab using "./tables/table_s1.tex", replace                                   ///
cells("mean(fmt(2)) sd(fmt(2)) p50(fmt(2)) min(fmt(2)) max(fmt(2))")            ///
noobs label nonumber title("Descriptive statistics")                                         

* remove the statistics from memory --------------------------------------------

eststo clear